// 热门推荐
$.ajax({
    method: 'get',
    url: 'http://localhost:3000/posts/recommend',
    success: function (res) {
        // console.log(res);
        var recommendTpl = `
        {{each data}}
        <li>
        <a href="detail.html?id={{$value._id}}">
          <img src="{{$value.thumbnail}}" alt="">
          <span>{{$value.title}}</span>
        </a>
      </li>
        {{/each}}
        `;
        var html = template.render(recommendTpl, {
            data: res
        });
        $('#recommendBox').html(html)
    }
})